<template>
  <div class="page-container">
    <div class="page-content">
      <div class="panel-container">
        <div class="panel-content">
          <div class="panel-line space-between">
            <div class="panel-left">
              <el-radio-group v-model="tabActive" style="margin-right: 30px" size="mini" @change="handleTabChange">
                <el-radio-button v-for="item in tabList" :key="item.value" :label="item.value">{{ item.label }}({{ item.num }})</el-radio-button>
              </el-radio-group>
              <el-button class="show-search" type="text" @click="handleShowSearch">
                <span v-if="showSearch"> 收起搜索 </span>
                <span v-else> 展开搜索 </span>
                <i class="el-icon-arrow-down" :class="{ rotate: showSearch }"></i>
              </el-button>
            </div>
            <div class="panel-right">
              <el-button type="primary" @click="handlePublish" size="mini">+ 新增</el-button>
            </div>
          </div>
          <!--搜索-->
          <SearchUiNew ref="SearchUiNew" v-show="showSearch" style="margin-top: 10px" :searchFormArr="searchFormArr" @searchParma="searchParma" @resetForm="handleResetForm"></SearchUiNew>
        </div>
      </div>
      <!--数据信息-->
      <div class="panel-container no-margin">
        <el-table stripe v-show="tabActive !== 5" :data="dataList" size="mini" :header-cell-style="{ background: '#F5F5F5', color: '#000000' }" ref="table" style="width: 100%" @selection-change="handleSelectionChange" v-loading="dataListLoading">
          <el-table-column type="selection" min-width="4%"> </el-table-column>
          <el-table-column header-align="center" label="拍卖名称" prop="title" min-width="20%">
            <template slot-scope="scope">
              <a v-if="(scope.row.sts === 1 || scope.row.sts === 2 || scope.row.sts === 3) && scope.row.number_id" class="notice-title" :href="`https://www.feijiu.net/gonggao/${scope.row.number_id}.html`" target="_blank"> {{ scope.row.title }}</a>
              <span v-else> {{ scope.row.title }}</span>
            </template>
          </el-table-column>
          <el-table-column align="center" header-align="center" label="公司名称" prop="company_name" min-width="8%"></el-table-column>
          <el-table-column align="center" header-align="center" label="发布人" prop="pub_man_name" min-width="8%"></el-table-column>
          <el-table-column v-if="tabActive === 4" align="center" header-align="center" label="采集时间" prop="craw_time" min-width="8%"></el-table-column>
          <el-table-column v-if="tabActive === '' || tabActive === 1 || tabActive === 2 || tabActive === 3" align="center" header-align="center" label="公告发布时间" prop="public_time" min-width="8%"></el-table-column>
          <el-table-column align="center" header-align="center" label="拍卖招标时间" prop="sell_time" min-width="8%"></el-table-column>
          <el-table-column align="center" header-align="center" label="联系人" prop="user_name" min-width="8%"></el-table-column>
          <el-table-column align="center" header-align="center" label="联系电话" prop="user_phone" min-width="8%"></el-table-column>
          <el-table-column align="center" header-align="center" label="类型" min-width="4%">
            <template slot-scope="scope">
              {{ getImportantType(scope.row.impt_type) }}
            </template>
          </el-table-column>
          <el-table-column align="center" header-align="center" label="是否爬虫数据" min-width="8%">
            <template slot-scope="scope">
              {{ getIsCraw(scope.row.is_craw) }}
            </template>
          </el-table-column>
          <el-table-column align="center" header-align="center" label="报名截止时间" prop="apply_end_time" min-width="8%"></el-table-column>
          <el-table-column align="center" header-align="center" label="ID" prop="number_id" min-width="8%"></el-table-column>
          <el-table-column align="center" header-align="center" label="操作" min-width="8%">
            <template slot-scope="scope">
              <el-button type="text" @click="handleDetail(scope)">查看</el-button>
              <el-button type="text" @click="handleEdit(scope)">编辑</el-button>
              <el-button type="text" @click="handleSignUp(scope)" v-if="scope.row.sts !== 4 && scope.row.sts !== 5">查看报名</el-button>
              <el-button type="text" @click="handleDelete(scope)" v-if="scope.row.sts !== 5" class="button-danger">删除</el-button>
              <!-- 2024/11/18 去掉恢复功能 -->
              <!-- <el-button type="text" @click="handleBack(scope)" v-else class="button-danger">恢复</el-button> -->
            </template>
          </el-table-column>
        </el-table>
        <el-table stripe v-show="tabActive === 5" :data="dataList" size="mini" :header-cell-style="{ background: '#F5F5F5', color: '#000000' }" ref="table1" style="width: 100%" @selection-change="handleSelectionChange" v-loading="dataListLoading">
          <el-table-column type="selection" min-width="4%"> </el-table-column>
          <el-table-column align="center" header-align="center" label="拍卖名称" prop="title" min-width="20%"> </el-table-column>
          <el-table-column align="center" header-align="center" label="公司名称" prop="company_name" min-width="8%"></el-table-column>
          <el-table-column align="center" header-align="center" label="发布人" prop="pub_man_name" min-width="8%"></el-table-column>
          <el-table-column align="center" header-align="center" label="采集时间" prop="craw_time" min-width="8%"></el-table-column>
          <el-table-column align="center" header-align="center" label="删除时间" prop="delete_time" min-width="8%"></el-table-column>
          <el-table-column align="center" header-align="center" label="删除人" prop="delete_man_name" min-width="8%"></el-table-column>
          <el-table-column align="center" header-align="center" label="ID" prop="number_id" min-width="8%"></el-table-column>
          <el-table-column align="center" header-align="center" label="操作" min-width="8%">
            <template slot-scope="scope">
              <el-button type="text" @click="handleDetail(scope)">查看</el-button>
              <el-button type="text" @click="handleEdit(scope)">编辑</el-button>
              <!-- 2024/11/18 去掉恢复功能 -->
              <!-- <el-button type="text" @click="handleBack(scope)" class="button-danger">恢复</el-button> -->
            </template>
          </el-table-column>
        </el-table>
        <el-pagination
          small
          background
          :current-page="pageNumber"
          :page-size="pageSize"
          :page-sizes="[10, 20, 50, 100]"
          :total="pageTotal"
          @current-change="currentChangeHandle"
          @size-change="sizeChangeHandle"
          layout="total, sizes, prev, pager, next, jumper"
          style="margin-top: 20px; text-align: right"
        ></el-pagination>
        <div class="panel-line" style="margin-top: 20px">
          <el-button v-if="tabActive !== 5" type="danger" @click="handleDeleteMultiple" size="mini" :disabled="multipleSelection.length === 0">删除</el-button>
          <!-- 2024/11/18 去掉恢复功能 -->
          <!-- <el-button v-else type="warning" @click="handleBackMultiple" size="mini" :disabled="multipleSelection.length === 0">恢复</el-button> -->
        </div>
      </div>
    </div>

    <!--  公告报名 -->
    <el-dialog title="报名记录" :visible.sync="showDialogSignUp" width="90%" top="30px">
      <DialogSignUp v-if="showDialogSignUp" @close="showDialogSignUp = false" :id="currentId" />
    </el-dialog>
  </div>
</template>

<script>
import { apiNoticeList, apiNoticeDel, apiNoticeBack } from '@/api/biddingNotice'
import DialogSignUp from '../noticeBoard/components/DialogSignUp.vue'

export default {
  name: 'NoticeManagement',
  components: { DialogSignUp },
  data() {
    const searchList1 = ['title', 'company_name', 'user_phone', 'evaluation', 'zone', 'timeSell', 'timePub', 'desc', 'pub_man_id', 'is_user_edit']
    const searchList2 = ['title', 'delete_man_name', 'pub_man_name', 'zone', 'timeDelete', 'timeCreate', 'desc', 'pub_man_id', 'is_user_edit']
    const searchList3 = ['title', 'company_name', 'user_phone', 'evaluation', 'zone', 'timeSell', 'timePub', 'is_ai', 'desc', 'pub_man_id', 'is_user_edit']
    const searchList4 = ['title', 'company_name', 'user_phone', 'evaluation', 'zone', 'timeSell', 'timeCreate', 'desc', 'pub_man_id', 'is_user_edit']
    const paramsList1 = ['title', 'company_name', 'user_phone', 'evaluation', 'sell_start_time', 'sell_end_time', 'pub_start_time', 'pub_end_time', 'sheng_id', 'shi_id', 'zone_id', 'is_area_choice', 'desc', 'pub_man_id', 'is_user_edit']
    const paramsList2 = ['title', 'pub_man_name', 'delete_man_name', 'delete_start_time', 'delete_end_time', 'start_time', 'end_time', 'sheng_id', 'shi_id', 'zone_id', 'is_area_choice', 'desc', 'pub_man_id', 'is_user_edit']
    const paramsList3 = ['title', 'company_name', 'user_phone', 'evaluation', 'sell_start_time', 'sell_end_time', 'pub_start_time', 'pub_end_time', 'sheng_id', 'shi_id', 'zone_id', 'is_area_choice', 'is_ai', 'desc', 'pub_man_id', 'is_user_edit']
    const paramsList4 = ['title', 'company_name', 'user_phone', 'evaluation', 'sell_start_time', 'sell_end_time', 'start_time', 'end_time', 'sheng_id', 'shi_id', 'zone_id', 'is_area_choice', 'desc', 'pub_man_id', 'is_user_edit']
    const stsList = [
      { value: 4, label: '采集待处理', num_name: 'w4', num: 0, searchList: searchList4, paramsList: paramsList4 },
      { value: 3, label: '先发后审', num_name: 'w3', num: 0, searchList: searchList1, paramsList: paramsList1 },
      { value: 1, label: '人工发布', num_name: 'w1', num: 0, searchList: searchList3, paramsList: paramsList3 },
      { value: 2, label: '自动发布', num_name: 'w2', num: 0, searchList: searchList1, paramsList: paramsList1 },
      { value: 5, label: '已失效', num_name: 'w5', num: 0, searchList: searchList2, paramsList: paramsList2 },
      { value: '', label: '全部', num_name: 'total', num: 0, searchList: searchList1, paramsList: paramsList1 },
    ]
    const importantTypeList = [
      { value: 1, label: '重要' },
      { value: 2, label: '普通' },
    ]
    const isCrawList = [
      { value: 1, label: '是' },
      { value: 2, label: '否' },
    ]
    return {
      stsList,
      importantTypeList,
      isCrawList,
      query: {},
      multipleSelection: [],
      showSearch: false,
      tabActive: 4,
      tabList: stsList,
      searchFormArr: [
        {
          fieldName: '拍卖名称:',
          type: 'input',
          field: 'title',
          hidden: false,
          placeholder: '请输入拍卖名称',
        },
        {
          fieldName: '公司名称:',
          type: 'input',
          field: 'company_name',
          hidden: false,
          placeholder: '请输入公司名称',
        },
        {
          fieldName: '联系电话:',
          type: 'input',
          field: 'user_phone',
          hidden: false,
          placeholder: '请输入联系电话',
        },
        {
          fieldName: '评估价:',
          type: 'select',
          field: 'evaluation',
          hidden: false,
          placeholder: '请选择',
          option: [],
        },
        {
          fieldName: '删除人:',
          type: 'input',
          field: 'delete_man_name',
          hidden: false,
          placeholder: '请输入删除人',
        },
        {
          fieldName: '发布人:',
          type: 'input',
          field: 'pub_man_name',
          hidden: false,
          placeholder: '请输入发布人',
        },
        {
          fieldName: '所属地区:',
          type: 'cascader',
          field: 'zone',
          hidden: false,
          props: { value: 'code', label: 'name', checkStrictly: true, multiple: 'true' },
          option: [],
        },
        {
          fieldName: '是否爬虫数据:',
          type: 'radioGroup',
          field: 'is_ai',
          hidden: false,
          option: [
            { value: 1, label: '是' },
            { value: 2, label: '否' },
          ],
        },
        {
          fieldName: '招标时间:',
          type: 'timePicker',
          field: 'timeSell',
          hidden: false,
          placeholder: '请选择招标时间',
          timeType: 'daterange',
          format: 'yyyy-MM-dd',
        },
        {
          fieldName: '发布时间:',
          type: 'timePicker',
          field: 'timePub',
          hidden: false,
          placeholder: '请选择发布时间',
          timeType: 'daterange',
          format: 'yyyy-MM-dd',
        },
        {
          fieldName: '删除时间:',
          type: 'timePicker',
          field: 'timeDelete',
          hidden: false,
          placeholder: '请选择删除时间',
          timeType: 'daterange',
          format: 'yyyy-MM-dd',
        },
        {
          fieldName: '采集时间:',
          type: 'timePicker',
          field: 'timeCreate',
          hidden: false,
          placeholder: '请选择采集时间',
          timeType: 'daterange',
          format: 'yyyy-MM-dd',
        },
        {
          fieldName: '内容:',
          type: 'input',
          field: 'desc',
          hidden: false,
          placeholder: '请输入内容',
        },
        {
          fieldName: '发布人:',
          type: 'select',
          field: 'pub_man_id',
          hidden: false,
          placeholder: '请选择',
          option: [],
        },
        {
          fieldName: '人工修改:',
          type: 'select',
          field: 'is_user_edit',
          hidden: false,
          placeholder: '请选择',
          option: [
            { value: '', label: '全部' },
            { value: 1, label: '是' },
            { value: 0, label: '否' },
          ],
        },
      ],
      searchParams: {
        title: '',
        company_name: '',
        user_phone: '',
        evaluation: '',
        pub_man_name: '',
        delete_man_name: '',
        delete_start_time: '',
        delete_end_time: '',
        sell_start_time: '',
        sell_end_time: '',
        pub_start_time: '',
        pub_end_time: '',
        start_time: '',
        end_time: '',
        sheng_id: [],
        shi_id: [],
        zone_id: [],
        is_area_choice: '',
        desc: '',
        pub_man_id: '',
        is_user_edit: '',
      },
      dataList: [],
      pageNumber: 1,
      pageSize: 10,
      pageTotal: 0,
      dataListLoading: false,
      showDialogSignUp: false,
      currentId: '',
    }
  },
  activated() {
    this.$refs.table && this.$refs.table.doLayout()
    this.$refs.table1 && this.$refs.table1.doLayout()
  },
  mounted() {
    this.$bus.$on('noticeListUpdate', this.getDataList)
    this.init()
  },
  destroyed() {
    this.$bus.$off('noticeListUpdate', this.getDataList)
  },
  methods: {
    // 初始化
    init() {
      // 初始化筛选
      this.getSelectList()
      this.query = this.$route.query
      const { phone, start_time, end_time, tab, is_ai } = this.query
      if (tab !== undefined) {
        this.tabActive = tab
      }
      this.searchFormChange()
      if (phone) {
        this.showSearch = true
        this.searchParams.user_phone = phone
      }
      if (start_time && end_time) {
        this.showSearch = true
        if (parseInt(tab) === 4) {
          this.searchParams.start_time = start_time
          this.searchParams.end_time = end_time
        } else if (parseInt(tab) === 5) {
          this.searchParams.delete_start_time = start_time
          this.searchParams.delete_end_time = end_time
        } else {
          this.searchParams.pub_start_time = start_time
          this.searchParams.pub_end_time = end_time
        }
      }
      if (is_ai) {
        this.showSearch = true
        this.searchParams.is_ai = is_ai
      }
      this.$nextTick(() => {
        const setItemList = []
        if (phone) {
          setItemList.push({ key: 'search', value: phone })
          setItemList.push({ key: 'search_type', value: 'user_phone' })
        }
        if (start_time && end_time) {
          if (parseInt(tab) === 4) {
            setItemList.push({ key: 'timeCreate', value: [start_time, end_time] })
          } else if (parseInt(tab) === 5) {
            setItemList.push({ key: 'timeDelete', value: [start_time, end_time] })
          } else {
            setItemList.push({ key: 'timePub', value: [start_time, end_time] })
          }
        }
        if (is_ai) {
          setItemList.push({ key: 'is_ai', value: is_ai })
        }
        if (setItemList.length > 0) {
          this.$refs.SearchUiNew.setItemValue(setItemList)
        } else {
          this.getDataList()
        }
      })
    },
    handleShowSearch() {
      this.showSearch = !this.showSearch
    },
    searchFormChange() {
      const showList = this.tabList.find((item) => item.value === this.tabActive).searchList
      this.searchFormArr.forEach((item) => {
        if (showList.includes(item.field)) {
          item.hidden = false
        } else {
          item.hidden = true
        }
      })
    },
    // 获取下拉数据
    getSelectList() {
      this.$store.dispatch('select/getEvaluationList').then((res) => {
        const formItem = this.searchFormArr.find((item) => item.field === 'evaluation')
        formItem.option = res
      })
      this.$store.dispatch('select/getCityList').then((res) => {
        const formItem = this.searchFormArr.find((item) => item.field === 'zone')
        formItem.option = [
          {
            code: -1,
            name: '未分配地区',
          },
          {
            code: -2,
            name: '全国',
          },
          ...res,
        ]
      })
      this.$store.dispatch('select/getUserList').then((res) => {
        const formItem = this.searchFormArr.find((item) => item.field === 'pub_man_id')
        formItem.option = res
      })
    },
    // 获取数据列表
    getDataList() {
      this.dataListLoading = true
      let info = { pageNumber: this.pageNumber, pageSize: this.pageSize, sts: this.tabActive }
      const paramsList = this.tabList.find((item) => item.value === this.tabActive).paramsList
      paramsList.forEach((item) => {
        info[item] = this.searchParams[item]
      })
      apiNoticeList(info)
        .then((res) => {
          const { data, total, others } = res
          this.dataList = data
          this.pageTotal = total
          this.dataListLoading = false
          this.tabList.forEach((item) => {
            item.num = others[item.num_name]
          })
          this.$refs.table && this.$refs.table.doLayout()
          this.$refs.table1 && this.$refs.table1.doLayout()
        })
        .catch((e) => {
          this.dataList = []
          this.pageTotal = 0
          this.dataListLoading = false
        })
    },
    // 列表查询
    searchParma(e) {
      let list = ['zone', 'timeSell', 'timePub', 'timeDelete', 'timeCreate']
      this.searchFormArr.forEach((item) => {
        if (list.includes(item.field)) return
        if (e[item.field] || e[item.field] === 0) {
          this.searchParams[item.field] = e[item.field]
        } else {
          this.searchParams[item.field] = ''
        }
      })
      if (e.zone) {
        this.areaDefault = e.zone
        this.searchParams.sheng_id = []
        this.searchParams.shi_id = []
        this.searchParams.zone_id = []
        this.searchParams.is_area_choice = 0
        let all = false
        e.zone.forEach((item) => {
          if (item[0] === -2) {
            // 全国
            all = true
          } else if (item[0] === -1) {
            // 未分配地区
            this.searchParams.is_area_choice = 1
          } else {
            const length = item.length
            if (length === 1) {
              this.searchParams.sheng_id.push(item[0])
            } else if (length === 2) {
              this.searchParams.shi_id.push(item[1])
            } else if (length === 3) {
              this.searchParams.zone_id.push(item[2])
            }
          }
        })
        if (all) {
          this.searchParams.sheng_id = []
          this.searchParams.shi_id = []
          this.searchParams.zone_id = []
          this.searchParams.is_area_choice = 0
        }
      } else {
        this.searchParams.sheng_id = this.searchParams.shi_id = this.searchParams.zone_id = []
      }
      if (e.timeSell) {
        this.searchParams.sell_start_time = e.timeSell[0]
        this.searchParams.sell_end_time = e.timeSell[1]
      } else {
        this.searchParams.sell_start_time = this.searchParams.sell_end_time = ''
      }
      if (e.timePub) {
        this.searchParams.pub_start_time = e.timePub[0]
        this.searchParams.pub_end_time = e.timePub[1]
      } else {
        this.searchParams.pub_start_time = this.searchParams.pub_end_time = ''
      }
      if (e.timeDelete) {
        this.searchParams.delete_start_time = e.timeDelete[0]
        this.searchParams.delete_end_time = e.timeDelete[1]
      } else {
        this.searchParams.delete_start_time = this.searchParams.delete_end_time = ''
      }
      if (e.timeCreate) {
        this.searchParams.start_time = e.timeCreate[0]
        this.searchParams.end_time = e.timeCreate[1]
      } else {
        this.searchParams.start_time = this.searchParams.end_time = ''
      }
      this.pageNumber = 1
      this.getDataList()
    },
    // 每页数
    sizeChangeHandle(val) {
      this.pageSize = val
      this.pageNumber = 1
      this.getDataList()
    },
    // 当前页
    currentChangeHandle(val) {
      this.pageNumber = val
      this.getDataList()
    },
    // 切换tab
    handleTabChange() {
      this.searchFormChange()
      this.pageNumber = 1
      this.getDataList()
    },
    // 查看
    handleDetail(scope) {
      this.$store.dispatch('permission/routeAuthorization', 'NoticeDetail').then((res) => {
        let info = { pageNumber: this.pageNumber, pageSize: this.pageSize, sts: this.tabActive }
        const paramsList = this.tabList.find((item) => item.value === this.tabActive).paramsList
        paramsList.forEach((item) => {
          info[item] = this.searchParams[item]
        })
        info.position = scope.$index
        window.localStorage.setItem('notice-edit-table-query', JSON.stringify(info))
        this.$bus.$emit('forceUpdate', 'NoticeDetail')
        this.$router.push({
          path: '/biddingNotice/noticeDetail',
          query: {
            id: scope.row.id,
          },
        })
      })
    },
    // 编辑
    handleEdit(scope) {
      this.$store.dispatch('permission/routeAuthorization', 'NoticePublish').then((res) => {
        let info = { pageNumber: this.pageNumber, pageSize: this.pageSize, sts: this.tabActive }
        const paramsList = this.tabList.find((item) => item.value === this.tabActive).paramsList
        paramsList.forEach((item) => {
          info[item] = this.searchParams[item]
        })
        info.position = scope.$index
        window.localStorage.setItem('notice-edit-table-query', JSON.stringify(info))
        // 编辑新窗口打开
        window.open(`${location.origin}/#/biddingNotice/noticePublish?id=${scope.row.id}`)
      })
    },
    // 发布
    handlePublish() {
      this.$store.dispatch('permission/routeAuthorization', 'NoticePublish').then((res) => {
        this.$bus.$emit('forceUpdate', 'NoticePublish')
        this.$router.push({
          path: '/biddingNotice/noticePublish',
        })
      })
    },
    // 查看报名
    handleSignUp(scope) {
      this.currentId = scope.row.id
      this.showDialogSignUp = true
    },
    // 删除
    handleDelete(scope) {
      this.noticeDelete([scope.row.id])
    },
    // 恢复
    // <!-- 2024/11/18 去掉恢复功能 -->
    handleBack(scope) {
      this.noticeBack([scope.row.id])
    },
    // 获取状态
    getSts(value) {
      const item = this.stsList.find((item) => item.value === value)
      if (item) {
        return item.label
      } else {
        return ''
      }
    },
    // 获取重要类型
    getImportantType(value) {
      const item = this.importantTypeList.find((item) => item.value === value)
      if (item) {
        return item.label
      } else {
        return ''
      }
    },
    // 获取是否爬虫数据
    getIsCraw(value) {
      const item = this.isCrawList.find((item) => item.value === value)
      if (item) {
        return item.label
      } else {
        return ''
      }
    },
    // 表格多选
    handleSelectionChange(val) {
      this.multipleSelection = val
    },
    // 多选删除
    handleDeleteMultiple() {
      this.noticeDelete(this.multipleSelection.map((item) => item.id))
    },
    // 多选恢复
    // <!-- 2024/11/18 去掉恢复功能 -->
    handleBackMultiple() {
      this.noticeBack(this.multipleSelection.map((item) => item.id))
    },
    // 恢复
    // <!-- 2024/11/18 去掉恢复功能 -->
    noticeBack(ids) {
      window.enterPreventDefault = false
      this.$confirm('确认回退到待处理状态吗？', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      })
        .then(() => {
          window.enterPreventDefault = true
          this.dataListLoading = true
          apiNoticeBack({ ids })
            .then(() => {
              this.dataListLoading = false
              this.$message({
                type: 'success',
                message: '操作成功!',
              })
              if (ids.length === this.dataList.length && this.tabActive === 5 && this.pageNumber > 1) {
                this.pageNumber--
              }
              this.getDataList()
            })
            .catch(() => {
              this.dataListLoading = false
            })
        })
        .catch(() => {
          window.enterPreventDefault = true
        })
    },
    // 删除
    noticeDelete(ids) {
      window.enterPreventDefault = false
      this.$confirm('确定要删除选中信息？', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      })
        .then(() => {
          window.enterPreventDefault = true
          this.dataListLoading = true
          apiNoticeDel({ ids, flag: this.tabActive === 4 ? 2 : 1 })
            .then(() => {
              this.dataListLoading = false
              this.$message({
                type: 'success',
                message: '删除成功!',
              })
              if (ids.length === this.dataList.length && (this.tabActive === 1 || this.tabActive === 2 || this.tabActive === 3 || this.tabActive === 4) && this.pageNumber > 1) {
                this.pageNumber--
              }
              this.getDataList()
            })
            .catch(() => {
              this.dataListLoading = false
            })
        })
        .catch(() => {
          window.enterPreventDefault = true
        })
    },
    // 跳转
    handleLink(scope) {
      window.open(`https://www.feijiu.net/gonggao/${scope.row.number_id}.html`)
    },
    // 重置筛选
    handleResetForm() {
      this.searchParams.is_area_choice = ''
    },
  },
}
</script>
<style lang="scss" scoped>
.notice-title {
  color: #409eff;
  cursor: pointer;
  &:hover {
    text-decoration: underline;
  }
}

::v-deep .el-table--scrollable-x .el-table__body-wrapper {
  overflow-x: hidden;
}

.el-table {
  font-size: 14px;
}
::v-deep .el-table tr {
  background-color: #e5eef5;
}
</style>
